<?php

namespace App\Http\Controllers\Manger;

use App\Http\Controllers\BaseController;
use App\Models\CompanyinfoDinding;
use App\Services\DingDing\DingDingSer;
use Illuminate\Http\Request;

class DingdingController extends BaseController
{
    public function syncdinguserinfo(Request $request)
    {
        try {
            $cpd = CompanyinfoDinding::where(['id' => $this->mangerinfo['cpd_id']])->first();
            if (!$cpd) {

                return response()->json(['code' => '001', 'msg' => '请先配置钉钉部门信息']);
            }
            $cpd = $cpd->toArray();
            DingDingSer::getDepartmentUserInfoListByDeptId($cpd);
        } catch (\Exception $e) {
            return response()->json(['code' => '001', 'msg' => $e->getMessage()]);
        }
        return response()->json(['code' => '000', 'msg' => '操作成功']);
    }
}
